Conditions | 2 |
Paths | 2 |
Total Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | var webpackConf = require('./webpack.config.js'); |
||
2 | module.exports = function (config) { |
||
3 | config.set({ |
||
4 | basePath:'', |
||
5 | frameworks: ['jasmine'], |
||
6 | files: [{ pattern: './tests/unit/spec-bundle.js', watched: false }], |
||
7 | preprocessors: { './tests/unit/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] }, |
||
8 | webpack: { |
||
9 | module: webpackConf.module, |
||
10 | resolve: webpackConf.resolve |
||
11 | }, |
||
12 | webpackMiddleware: { |
||
13 | noInfo: true, |
||
14 | stats: 'errors-only' |
||
15 | }, |
||
16 | reporters: ['kjhtml', 'spec', 'coverage'], |
||
17 | // optionally, configure the reporter |
||
18 | coverageReporter: { |
||
19 | // specify a common output directory |
||
20 | dir: './tests/build/reports/coverage', |
||
21 | reporters: [ |
||
22 | // reporters not supporting the `file` property |
||
23 | { type: 'html', subdir: 'report-html' }, |
||
24 | { type: 'lcov', subdir: 'report-lcov' }, |
||
25 | // reporters supporting the `file` property, use `subdir` to directly |
||
26 | // output them in the `dir` directory |
||
27 | { type: 'cobertura', subdir: '.', file: 'cobertura.txt' }, |
||
28 | { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' }, |
||
29 | { type: 'teamcity', subdir: '.', file: 'teamcity.txt' }, |
||
30 | { type: 'text', subdir: '.', file: 'text.txt' }, |
||
31 | { type: 'text-summary', subdir: '.', file: 'text-summary.txt' }, |
||
32 | ] |
||
33 | }, |
||
34 | specReporter: { |
||
35 | maxLogLines: 5, // limit number of lines logged per test |
||
36 | suppressErrorSummary: true, // do not print error summary |
||
37 | suppressFailed: false, // do not print information about failed tests |
||
38 | suppressPassed: false, // do not print information about passed tests |
||
39 | suppressSkipped: true, // do not print information about skipped tests |
||
40 | showSpecTiming: false // print the time elapsed for each spec |
||
41 | }, |
||
42 | customLaunchers: { |
||
43 | Chrome_travis_ci: { |
||
44 | base: 'Chrome', |
||
45 | flags: ['--no-sandbox'] |
||
46 | } |
||
47 | }, |
||
48 | port: 9876, |
||
49 | colors: true, |
||
50 | logLevel: config.LOG_INFO, |
||
51 | autoWatch: true, |
||
52 | browsers: ['Chrome'], |
||
53 | singleRun: true, |
||
54 | concurrency: Infinity |
||
55 | }); |
||
56 | |||
57 | |||
58 | if (process.env.TRAVIS) { |
||
59 | config.browsers = ['Chrome_travis_ci']; |
||
60 | } |
||
61 | }; |
||
62 |